package zhujie.service.impl;

import zhujie.dao.StudentDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import zhujie.entity.Student;
import zhujie.service.QueryService;

import java.util.List;
@Service("queryService")
@Transactional(propagation = Propagation.SUPPORTS)
public class QueryServiceImpl implements QueryService {

    private StudentDao studentDao;

    public StudentDao getStudentDao() {
        return studentDao;
    }

    @Autowired
    public void setStudentDao(@Qualifier("studentDao") StudentDao studentDao) {
        this.studentDao = studentDao;
    }

    @Override
    public List<Student> queryStudents() {
        return studentDao.queryStudents();
    }

    @Override
    public Student queryStudent(int id) {
        return studentDao.queryStudent(id);
    }
}
